package com.example.onlineeducation.mapper

import com.example.onlineeducation.data.json.ExamRecordListJson
import com.example.onlineeducation.data.model.ExamRecordListDataModel
import com.yc.jetpacklib.extension.ycToNoEmpty
import com.yc.jetpacklib.mapper.IMapper

class ExamRecordListMapper : IMapper<ExamRecordListJson, ExamRecordListDataModel> {
    override fun map(input: ExamRecordListJson): ExamRecordListDataModel = ExamRecordListDataModel(
        input.id,//考试记录的id
        input.examId,//考试的id
        input.examInfo?.name.ycToNoEmpty(),
        input.mediaInfo?.webPath,
        "通过分数：${input.examInfo?.needPoint.ycToNoEmpty("0")}分",//总成绩
        input.createTime.ycToNoEmpty(),//考试日期（哪天参加考试的）
        "${input.point.ycToNoEmpty("0")}分",//实际成绩
        input.isPass.ycToNoEmpty(),//是否通过 0-未通过  1-已通过
        input.examInfo?.times,//考试总时长(分钟)
        input.examInfo?.endTime,//考试最晚结束时间
    )
}
